package com.wei.czz.framework.admin.controller;

import com.wei.czz.common.annotation.Auth;
import com.wei.czz.common.dto.admin.UserAppealDto;
import com.wei.czz.common.tool.Result;
import com.wei.czz.framework.admin.service.UserAppealService;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wei
 * date: 2022-04-15 21:40:54
 * className: UserAppealController 用户申诉记录请求接口类
 * version: 1.0
 * description:
 */
@RestController
@RequestMapping("/sys/user-appeal")
@AllArgsConstructor
public class UserAppealController {

    private static final Logger log = LoggerFactory.getLogger(UserAppealController.class);

    private final UserAppealService userAppealService;

    /**
     * 获取用户申诉内容接口
     * 根据用户风控记录主键，获取用户最近一次申诉的申诉内容
     * @param riskFlowId 用户风控记录主键
     * @return 用户申诉内容
     */
    @GetMapping("/get")
    @Auth(permit = "user:risk:get")
    public Result<UserAppealDto> getUserAppealDesc(@RequestParam("riskFlowId") Long riskFlowId) {
        log.info("开始获取用户申诉内容业务。riskFlowId={}", riskFlowId);

        UserAppealDto userAppealDto = userAppealService.getUserAppeal(riskFlowId);

        log.info("获取用户申诉内容业务结束");
        return Result.success(userAppealDto);
    }

}
